package org.copper.utils
{
	public final class ConditionUtil
	{
		public static function assert(condition:Boolean, ...errorMessage):void
		{
			if (condition)
				return;
			else
				throw new Error(errorMessage.join(" "));
		}
		
		public static function containsAllKeys(dict:*, keys:Array):Boolean
		{
			if (keys == null)
				return false;
			
			if (keys.length < 1)
				return false;
			
			if (dict == null)
				return false;
			
			for each(var key:String in keys)
			{
				if (dict[key] == undefined)
					return false;
			}
			
			
			return true;
		}
		
		
		public static function containsAtLeastOneKey(dict:*, keys:Array):Boolean
		{
			if (keys == null)
				return false;
			
			if (keys.length < 1)
				return false;
			
			if (dict == null)
				return false;
			
			for each(var key:String in keys)
			{
				if (dict[key] != undefined)
					return true;
			}
			
			return false;
		}
	}
}